<include file="public@storage"/>
<link href="__STATIC__/storage/fileinput/css/fileinput.min.css" rel="stylesheet" type="text/css">
</head>
<body>

<div class="col-xs-12" style="margin-top: 5%">
    <a href="__STATIC__/storage/excel/出库单.xls" style="color: #777777;font-size: large">下载出库单模板</a>
    <div class="form-group">
        <div class="file-loading">
            <input id="file" type="file" class="file" multiple data-upload-url="{:url('storage/Bom/addBomFromExcel')}">
        </div>
    </div>
</div>
</body>
<script src="__STATIC__/storage/fileinput/js/fileinput.min.js"></script>
<script src="__STATIC__/storage/fileinput/js/zh.js"></script>
<script>
    $("#file").fileinput({
        language: 'zh', //设置语言
        theme: 'fa',
        allowedFileExtensions: ['xlsx', 'xls'],//接受的文件后缀
        uploadAsync: true, //默认异步上传
        showUpload:true, //是否显示上传按钮
        showRemove :true, //显示移除按钮
        showPreview :true, //是否显示预览
        showCaption:true,//是否显示标题
        browseClass:"btn btn-info", //按钮样式
        dropZoneEnabled: true,//是否显示拖拽区域
        //minImageWidth: 50, //图片的最小宽度
        //minImageHeight: 50,//图片的最小高度
        //maxImageWidth: 1000,//图片的最大宽度
        //maxImageHeight: 1000,//图片的最大高度
        //maxFileSize:0,//单位为kb，如果为0表示不限制文件大小
        //minFileCount: 0,
        maxFileCount:10 //表示允许同时上传的最大文件个数
    }).on('fileuploaded',function (event,data,previewId,index) {
        if(data.response.success === true){
            layer.msg(data.response.message);
            setTimeout(function () {
                location.reload();
            },1000);
        }else if(data.response.success === false){
            layer.alert(data.response.message);
            $("#file").fileinput('clear');
            setTimeout(function () {
                location.reload();
            },1000);
        }
    });
</script>
</html>